package com.nbsaas.sample.user.rest.convert;

import com.nbsaas.sample.entity.user.UserRole;
import com.nbsaas.sample.user.api.domain.request.UserRoleDataRequest;

import org.springframework.beans.BeanUtils;
import com.nbsaas.boot.rest.api.Converter;
import com.nbsaas.boot.utils.BeanDataUtils;
            import com.nbsaas.sample.entity.user.UserRoleCatalog;

/**
* 请求对象转换成实体对象
*/

public class UserRoleEntityConvert  implements Converter<UserRole, UserRoleDataRequest> {
@Override
public UserRole convert(UserRoleDataRequest source) {
UserRole result = new UserRole();
BeanDataUtils.copyProperties(source, result);
            if(source.getCatalog()!=null){
            UserRoleCatalog catalog =new UserRoleCatalog();
            catalog.setId(source.getCatalog());
            result.setCatalog(catalog);
            }
return result;
}
}

